import request from '@/config/axios'

// 财务部员工分值考核 VO
export interface EmployeeScoreVO {
  id: number // 主键ID
  years: number // 年份
  month: number // 月份
  userId: number // 员工id
  userName: string // 员工姓名
  totalEnterprises: number // 分配企业总户数
  smallScaleEnterprises: number // 小规模户数
  generalTaxpayerEnterprises: number // 一般纳税人户数
  smallScaleScore: number // 小规模分
  generalTaxpayerScore: number // 一般纳税人分
  simplifiedSmallScale: number // 简化小规模户数
  simplifiedGeneralTaxpayer: number // 简化一般纳税人户数
  simplifiedSmallScaleScore: number // 简化小规模分
  simplifiedGeneralTaxpayerScore: number // 简化一般纳税人分
  outsourcedSmallScale: number // 外包对接小规模户数
  outsourcedGeneralTaxpayer: number // 外包对接一般纳税人户数
  outsourcedSmallScaleScore: number // 外包对接小规模分
  outsourcedGeneralTaxpayerScore: number // 外包对接一般纳税人分
  invoiceScore: number // 开票分
  specialScore: number // 特殊分
  seniorityScore: number // 工龄分
  certificateScore: number // 证书分
  collectionCompletionRate: number // 收款完成率(%)
  collectionDeduction: number // 收款扣分
  complaintDeduction: number // 投诉扣分
  lossDeduction: number // 流失扣分
  accountingDeduction: number // 记账扣分
  otherDeduction: number // 其他扣分
  performanceDeductionSubtotal: number // 工作绩效考核扣分小计
  managerAssessmentScore: number // 负责人给予考核分
  totalScore: number // 总分值
  assessmentSalary: number // 考核工资
  otherAdjustment: number // 其他调整
  status: string // 状态
  remarks: string // 备注
}

// 财务部员工分值考核 API
export const EmployeeScoreApi = {
  // 查询财务部员工分值考核分页
  getEmployeeScorePage: async (params: any) => {
    return await request.get({ url: `/oa/employee-score/page`, params })
  },

  // 查询财务部员工分值考核详情
  getEmployeeScore: async (id: number) => {
    return await request.get({ url: `/oa/employee-score/get?id=` + id })
  },

  // 新增财务部员工分值考核
  createEmployeeScore: async (data: EmployeeScoreVO) => {
    return await request.post({ url: `/oa/employee-score/create`, data })
  },

  // 修改财务部员工分值考核
  updateEmployeeScore: async (data: EmployeeScoreVO) => {
    return await request.put({ url: `/oa/employee-score/update`, data })
  },

  // 删除财务部员工分值考核
  deleteEmployeeScore: async (id: number) => {
    return await request.delete({ url: `/oa/employee-score/delete?id=` + id })
  },

  // 导出财务部员工分值考核 Excel
  exportEmployeeScore: async (params) => {
    return await request.download({ url: `/oa/employee-score/export-excel`, params })
  },

  // 查询所有员工分值考核分页（人事专用）
  getAllEmployeeScorePage: async (params: any) => {
    return await request.get({ url: `/oa/employee-score/page-all`, params })
  },

  // 查询本人分值考核分页（员工自查）
  getMyEmployeeScorePage: async (params: any) => {
    return await request.get({ url: `/oa/employee-score/page-my`, params })
  },

  // 导入财务部员工分值考核 Excel
  importEmployeeScore: async (data: FormData) => {
    return await request.upload({ url: `/oa/employee-score/import-excel`, data })
  },

  // 下载财务部员工分值考核 Excel 导入模板
  downloadImportTemplate: async () => {
    return await request.download({ url: `/oa/employee-score/import-template` })
  },

  // 发布财务部员工分值考核
  publishEmployeeScore: async (id: number) => {
    return await request.put({ url: `/oa/employee-score/publish?id=` + id })
  },
}
